<div class="SipeiMain_r fr">
      <h2 class="clearfix fonts_18 height45 fontc_444">数据导入规则</h2>
	   <?php
	   $form = $this->beginWidget('CActiveForm', array(
	   'action' => Yii::app()->createUrl($this->route),
	   'method' => 'POST',
	   'id' => 'searchForm'));
		?>
      <ul class="clearfix back_bgf border_3 border_c pr30 pl30 pt20 pb20 height32 fontc_666">
        <li class="fl pt10 pr30 pb10">excel列名：<input type="text" name="rowname" value="<?php echo $serch['rowname']; ?>" class="pt6 pr9 pb6 pl9 border_3 border_c fontc_666 w100" />
		</li>
        <li class="fl pt10 pr30 pb10">数据表列名：<input type="text" name="tablerowname" value="<?php echo $serch['tablerowname']; ?>" class="pt6 pr9 pb6 pl9 border_3 border_c fontc_666 w100" />
		</li>
        <li class="fl pt10 pr30 pb10">
		<span class="fl pr8">是否生效</span><input type="checkbox" name="status"  class="fl mt9" <?php echo $serch['status'] == 1 ? 'checked=checked' : '';?>/>
		</li>
        <li class="fr pt10 pb10">
		<input type="submit" value="查询" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12" />
		</li>
      </ul>
	 <?php
	 $this->endWidget();
	?>
      <div class="clearfix back_bgf border_c mt15 pt20 pb20">
        <div class="clearfix pt10 pb10 pl30">
		<input type="button" value="新增" onclick="add(<?php echo $serch['id'];?>);" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10" />
		</div>
          <table class="height40" width="100%">
            <thead class="back_bgf5 fontc_666">
              <tr>
                <th width="139" align="center" class="m_hr_t m_hr_b">excel列名</th>
                <th width="153" align="center" class="m_hr_t m_hr_b pl30">数据表列名</th>
                <th width="230" align="center" class="m_hr_t m_hr_b">是否生效</th>
                <th width="440" align="left" class="m_hr_t m_hr_b pl20">备注</th>
                <th width="146" align="center" class="m_hr_t m_hr_b">操作</th>
              </tr>
            </thead>
            <tbody class="fontc_444">
			<?php if(!empty($data)): ?>
				<?php foreach($data as $value):?>
              <tr>
                <td align="center" class="m_hr_b"><?php echo $value['rowname']; ?></td>
				<td align="center" class="m_hr_b"><?php echo $value['tablerowname']; ?></td>
				<td align="center" class="m_hr_b">
				<input type="checkbox" <?php echo $value['status'] == 1 ? 'checked=checked' : '';?> />
				</td>
				<td align="left" class="m_hr_b pl20"><?php echo $value['remark']; ?></td>
                <td align="center" class="m_hr_b">
					<img src="/themes/default/images/Sipei/edit.png" title="编辑" class="pr15" onclick="update(<?php echo $value['id']; ?>,<?php echo $value['import_id']; ?>)" />
					<img src="/themes/default/images/Sipei/delate.png" title="删除" onclick="set_ok(<?php echo $value['id']; ?>,<?php echo $value['import_id']; ?>)" />
				</td>
              </tr>
              <?php endforeach;?>
			  <?php else: ?>
			  <tr>
                <td colspan="5"><h1 align="center">暂无数据</h1></td>
              </tr>
			  <?php endif; ?>
            </tbody>
          </table>
          <?php $this->renderPartial('//partial/partial_pager', array('pages' => $pages,"url"=>$pageUrl)); ?>
      </div>
    </div>
	
<script>
function set_ok(id,import_id) {
	if(confirm("确定要删除此数据")){
		location.href="<?php echo $this->createUrl("delete")?>/id/"+id+"/import_id/"+import_id;
	}else{
		return false;
	}
}
function add(id) {
	api = $.dialog({
		id: 'testID2',
		lock: true,
		padding:0,
		fixed: true,
		title:"新增",
		width:480,
		height:510,
		max: false,
		min: false
	});
	$.get('/import_rule/detail/add',{id:id,time:new Date()},function(html){
		api.content(html);
	});
}
function update(id,import_id) {
	api = $.dialog({
		id: 'testID2',
		lock: true,
		padding:0,
		fixed: true,
		title:"编辑",
		width:480,
		height:430,
		max: false,
		min: false
	});
	$.post('/import_rule/detail/update',{id:id,import_id:import_id,time:new Date()},function(html){
		api.content(html);
	});
}

</script>